package at.florian.dulzky.crawler;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;

public class Internet {
	
	URL url;
	public String getContentOfUrl(String url)
	{
		try {
			this.url = new URL(url);
			return this.readContent();
		} catch (Exception e) {
			System.out.println("Cannot get Content of Url: " + url);
		}
		return "";
	}
	
	private String readContent() throws IOException
	{
		String result = "";
		BufferedReader in = new BufferedReader(
				new InputStreamReader(this.url.openStream())
			);
		String line = "";
		while((line = in.readLine()) != null){
			result += line;
		}
		return result;
	}
}
